package com.shop2cn.iapi.shenqisettlement.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 根据国家获取汇率Call FreeMaker Template自动生成代码
 */
public class MerchantUpdatePaymentInfoCall extends YmatouBaseCall {
	private static String opurl = "/api/merchantUpdatePaymentInfo";

	public MerchantUpdatePaymentInfoCall() {
		super(EnvSetup.getSystemUrl("shenqisettlement_iapi"), opurl, "POST",
				"JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取BCode
	 * 
	 * @return
	 */
	public Integer getErrorCode() {
		Integer BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getInt("resultCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String msg = null;
		try {
			msg = new JSONObject(getReturnData()).getString("resultMessage");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return msg;
	}
	
	/**
	 * 获取success
	 * 
	 * @return
	 */
	public Boolean getSuccess() {
		Boolean success = null;
		try {
			success = new JSONObject(getReturnData()).getBoolean("success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return success;
	}
}